package cn.emove.modular.system.service;


import cn.emove.core.common.page.LayuiPageFactory;
import cn.emove.modular.system.entity.Meter;
import cn.emove.modular.system.mapper.MeterMapper;
import cn.emove.modular.system.model.MeterDto;
import cn.emove.modular.system.model.MeterLogDto;
import cn.emove.modular.system.model.MeterReadingDto;
import cn.stylefeng.roses.core.datascope.DataScope;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class MeterService extends ServiceImpl<MeterMapper, Meter> {
    public Page<Map<String, Object>> selectMeters(DataScope dataScope, String meterNo, String shopName, String shopAdr,  String meterStatus, String meterType, String meterModel) {
        Page page = LayuiPageFactory.defaultPage();
        return this.baseMapper.selectMeters(page,dataScope,meterNo, shopName,shopAdr,meterStatus,meterType,meterModel);
    }

    public Integer insertBatch(List<MeterReadingDto> list) {
        return this.baseMapper.insertBatch(list);
    }

    public MeterDto selectDataExist(String meterNo) {
        return this.baseMapper.selectDataExist(meterNo);
    }

    public Integer updateBatch(String[] array, String status, String remark) {
        return this.baseMapper.updateBatch(array,status,remark);
    }

    public Integer insertMeter(MeterDto meterDto) {
        return this.baseMapper.insertMeter(meterDto);
    }

    public Integer insertMeterLog(MeterLogDto meterLogDto) {
        return this.baseMapper.insertMeterLog(meterLogDto);
    }

    public Meter selectMeterById(int id) {
        return this.baseMapper.selectMeterById(id);
    }

    public Integer updateMeter(MeterDto meterDto) {
        return this.baseMapper.updateMeter(meterDto);
    }

    public Meter selectMeterByParam(String meterNo, Integer meterType) {
        return this.baseMapper.selectMeterByParam(meterNo,meterType);
    }

    public List<MeterLogDto> selectMeterLogByMeterId(int id) {
        return this.baseMapper.selectMeterLogByMeterId(id);
    }

    public Integer insertMeterBatch(List<MeterDto> list) {
        return this.baseMapper.insertMeterBatch(list);
    }

    public Integer insertOrUpdate(MeterDto meter) {
        return this.baseMapper.insertOrUpdate(meter);
    }

    public Integer logicRemoveById(Integer id) {
        return this.baseMapper.logicRemoveById(id);
    }

    public Map selectContract(String contractNo) {
        return this.baseMapper.selectContract(contractNo);
    }
}
